#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int Move(int n)
{
    if (n != 1)
    {
        return 3 * Move(n - 1) + 2;
    }
    else
    {
        return 2;
    }
}
int main()
{
    int n = 0;
    while (scanf("%d", &n) != EOF)
    {
        int count = Move(n);
        printf("%d\n", count);
    }
    return 0;
}